package ctrip.android.schedule.business.generatesoa{% if ClassSourceModel.class_name.endswith("Model") %}.model{% endif %};

import ctrip.android.schedule.business.util.{% if ClassSourceModel.class_name.endswith("Request") %}CtsBaseHTTPRequest{% elif ClassSourceModel.class_name.endswith("Response") %}CtsBaseHTTPResponse{% else %}CtsBeanModel{% endif %};

{% for field_model in ClassSourceModel.field_list -%}
{% if field_model.field_type.endswith("Model") -%}
import ctrip.android.schedule.business.generatesoa.model.{{field_model.field_type}};
{% endif %}
{%- endfor %}
{% for import_class in ClassSourceModel.import_class_list -%}
{{import_class}}
{% endfor %}
/**
 * @anthor ethan
 * {{ClassSourceModel.description}}
 * {{ClassSourceModel.service_code}}
 */
public class {{ClassSourceModel.class_name}} {% if ClassSourceModel.class_name.endswith("Request") %}extends CtsBaseHTTPRequest{% elif ClassSourceModel.class_name.endswith("Response") %}extends CtsBaseHTTPResponse{% else %}extends CtsBeanModel{% endif %} implements Cloneable{

	{% for field_model in ClassSourceModel.field_list -%}
	 {{field_model.field_description}} {%if ClassSourceModel.class_name.endswith("Request") and (field_model.field_type.endswith("Model") or field_model.field_type.startswith("ArrayList"))%}
	public {{field_model.field_type}} {{field_model.field_name}} = null;{%else%}
    public {{field_model.field_type}} {{field_model.field_name}} = {{field_model.default_value}};
    {%endif%}
	{% endfor %}

  {% if ClassSourceModel.class_name.endswith("Request") %}
    @Override
    public String getPath() {
    	return "/14912/{{ClassSourceModel.class_name[:-7]}}";
    }
  {% endif %}

	@Override
	public {{ClassSourceModel.class_name}} clone() {
		{{ClassSourceModel.class_name}} cloneObject = null;
		try {
			cloneObject = ({{ClassSourceModel.class_name}})super.clone();
			{% for field_model in ClassSourceModel.field_list -%}
      {% if field_model.field_type.startswith("ArrayList") and field_model.field_type.endswith("Model>") %}
			{{field_model.field_type}} clone{{field_model.field_name}} = ctrip.android.schedule.business.util.CtsBusinessListUtil.cloneList({{field_model.field_name}});
			cloneObject.{{field_model.field_name}} = clone{{field_model.field_name}};
			{% elif field_model.field_type.endswith("Model")-%}
			if(this.{{field_model.field_name}} != null)
				cloneObject.{{field_model.field_name}} = this.{{field_model.field_name}}.clone();
      {% elif field_model.field_type.startswith("ArrayList<Long>") or field_model.field_type.startswith("ArrayList<String>")-%}
      if(this.{{field_model.field_name}} != null)
  			cloneObject.{{field_model.field_name}} = ({{field_model.field_type}})this.{{field_model.field_name}}.clone();
			{% endif %}
			{%- endfor %}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return cloneObject;
	}

}
